function VSHResto()
	if not IsAddOnLoaded("PQInterface") then
		VAS_WriteToChat("\124cFFFF55FFWarning: only works with VSI addon!")
		return true
	end

	if not PQI_General_Resto_Shaman_GUI_Loaded then 	
		local config = {
			name	= 'General Resto Shaman',
			author	= 'Vachiusa',
			abilities = {
				-- General --
				{	name = "Auto Open PQI Options",
					tooltip = "Auto Opens PQI Options for you, will only happen once per login.",
					enable = true,
				},
				{	name = "54 Events",
					tooltip = "Enables the use of 5.4 boss specific mechanics",
					enable = true,
				},				
				{	name = "53 Events",
					tooltip = "Enables the use of 5.3 boss specific mechanics",
					enable = false,
				},
				{ 	name = "4x Events",
					enable = false,
					tooltip = "Enables the use of 4.x boss specific mechanics",
				},
				{ 	name = "Special Events",
					enable = false,
					tooltip = "Enables the use of special events mechanics (Providing Ground...)",
				},	
				{ 	name = "Auto Event Dispel",
					enable = true,
					tooltip = "Enables the use of dispel on special events mechanics",
				},								
				{ 	name = "Queue Sys",
					enable = true,
					tooltip = "Enables the use of auto dispel for Queue System",
				},					
				{ 	name = "Auto Target",
					enable = true,
					tooltip = "If you dont have a target it will target your focus target",
				},
				{ 	name = "Fix Tank ES",
					enable = false,
					tooltip = "Enables the use of Earth Shield tank name fixing",
						widget = { type = 'txtbox', 
					    value = 'TankName', 
					   	width = 120,													   --				  --														  --																																		   --															  --
						tooltip = 'Put your tank name for fixing ES here',
					 },					
				},																		
				{ 	name = "Spirit Link Totem",
					enable = false,
					tooltip = "Enables the use of Spirit Link Totem",
				},
				{ 	name = "DPS Totem",
					enable = false,
					tooltip = "Enables the use of DPS Totem",
				},								
				{ 	name = "Lightning Bolt",	
					enable = true,
					tooltip = "Enables the use of Lightning Bolt for DPS",
					widget = { type = 'numBox',
						value = 90,
						step = 1,
						max = 100,
						min = 0,
						tooltip = "The percent of minimum HP to use Lightning Bolt at",
					},
				},					
				{ 	name = "Force Lightning Bolt",	
					enable = true,
					tooltip = "Enables the force Lightning Bolt for Mana recover",
					widget = { type = 'numBox',
						value = 10,
						step = 1,
						max = 100,
						min = 0,
						tooltip = "The percent of Mana to force Lightning Bolt at",
					},
				},	
				{ 	name = "Purify Spirit",
					enable = true,
					tooltip = "Enables the use of Purify Spirit",
					widget = { type = 'numBox',
						value = 50,
						step = 1,
						max = 100,
						min = 0,
						tooltip = "The percent of HP to use Purify Spirit at",
					},
				},
				{ 	name = "Low Mana",	
					enable = true,
					tooltip = "Not work",
					widget = { type = 'numBox',
						value = 20,
						step = 1,
						max = 100,
						min = 0,
						tooltip = "The minimum percent of Mana to not use some high mana skills at",
					},
				},				
				{ 	name = "Racials",
					enable = true,
					tooltip = "Enables the use of Racials",
				},								
				{ 	name = "Target Heal",
					enable = false,
					tooltip = "Enables the use of Target Heal priority",
				},											
				{ 	name = "Mouseover Heal",
					enable = false,
					tooltip = "Enables the use of Mouseover Heal priority",
				},			
				{ 	name = "NPC Mouseover Heal",
					enable = false,
					tooltip = "Enables the use of NPC Mouseover Heal priority",
				},		
				{ 	name = "Pet Heal",
					enable = true,
					tooltip = "Enables the use of Pet Heal",
				},			
				{ 	name = "Stop Casting",
					enable = true,
					tooltip = "Enables the use of Stop Casting",
				},											
				{ 	name = "V debug",
					enable = false,
					tooltip = "Enables the use of Vachiusa debug",
				},					
			},
			hotkeys = {
			},
		}
		PQI_General_Resto_Shaman_GUI_Loaded = PQI:AddRotation(config)
	end		

	if not PQI_CD_Resto_Shaman_GUI_Loaded then 
		local config = {
			name	= 'CD Resto Shaman',
			author	= 'Vachiusa',
			abilities = {									
				-- CD's --
				{ 	name = "Spirit Walker Grace",
					enable = true,
					tooltip = "Enables the use of Spirit Walker Grace",
					widget = { type = 'numBox',
						value = 40,
						step = 1,
						max = 100,
						min = 0,
						tooltip = "The percent of HP to use Spirit Walker Grace at",
					},
				},
				{ 	name = "Mana Tide",
					enable = true,
					tooltip = "Enables the use of Mana Tide",
					widget = { type = 'numBox',
						value = 80,
						step = 1,
						max = 100,
						min = 0,
						tooltip = "The percent of Mana to use Mana Tide at",
					},
				},		
				{ 	name = "Chain Heal",
					enable = true,
					tooltip = "Enables the use of Chain Heal",
					widget = { type = 'numBox',
						value = 85,
						step = 1,
						max = 100,
						min = 0,
						tooltip = "The percent of HP to use Chain Heal at",
					},
				},				
				{ 	name = "Chain Heal Limit",
					enable = true,
					tooltip = "Not work",
					widget = { type = 'numBox',
						value = 2,
						step = 1,
						max = 10,
						min = 0,
						tooltip = "The number of low HP raid members around healing target to use Chain Heal at",
					},
				},								
				{ 	name = "Primal Elementalist",
					enable = true,
					tooltip = "Enables the use of Primal Elementalist",
					widget = { type = 'numBox',
						value = 80,
						step = 1,
						max = 100,
						min = 0,
						tooltip = "The percent of HP to use Primal Elementalist at",
					},
				},				
				{ 	name = "Primal Elementalist Limit",
					enable = true,
					tooltip = "Not work",
					widget = { type = 'numBox',
						value = 3,
						step = 1,
						max = 10,
						min = 0,
						tooltip = "The number of low HP raid members to use Primal Elementalist at",
					},
				},		
				{ 	name = "Primal Elementalist Buffs Only",
					enable = true,
					tooltip = "Enables the use of auto cast healing buffs only, not call pet!",
				},								
			},
			hotkeys = {
			},
		}
		PQI_CD_Resto_Shaman_GUI_Loaded = PQI:AddRotation(config)
	end		

	if not PQI_Healing_Resto_Shaman_GUI_Loaded then 
		local config = {
			name	= 'Healing Resto Shaman',
			author	= 'Vachiusa',
			abilities = {												
				-- Healing --
				{ 	name = "Riptide",
					enable = true,
					tooltip = "Enables the use of Riptide",
					widget = { type = 'numBox',
						value = 85,
						step = 1,
						max = 100,
						min = 0,
						tooltip = "The percent of HP to use Riptide at",
					},
				},
				{ 	name = "Riptide Tank",
					enable = true,
					tooltip = "Enables the use of Riptide on Tanks",
					widget = { type = 'numBox',
						value = 95,
						step = 1,
						max = 100,
						min = 0,
						tooltip = "The percent of HP to use Riptide on Tanks at",
					},
				},
				{ 	name = "Healing Surge",
					enable = true,
					tooltip = "Enables the use of Healing Surge",
					widget = { type = 'numBox',
						value = 20,
						step = 1,
						max = 100,
						min = 0,
						tooltip = "The percent of HP to use Healing Surge at",
					},
				},	
				{ 	name = "Healing Surge Tank",
					enable = true,
					tooltip = "Enables the use of Healing Surge on Tanks",
					widget = { type = 'numBox',
						value = 30,
						step = 1,
						max = 100,
						min = 0,
						tooltip = "The percent of HP to use Healing Surge on Tanks at",
					},
				},					
				{ 	name = "Greater Healing Wave",
					enable = true,
					tooltip = "Enables the use of Greater Healing Wave",
					widget = { type = 'numBox',
						value = 60,
						step = 1,
						max = 100,
						min = 0,
						tooltip = "The percent of HP to use Greater Healing Wave at",
					},
				},	
				{ 	name = "Healing Wave",
					enable = true,
					tooltip = "Enables the use of Healing Wave",
					widget = { type = 'numBox',
						value = 80,
						step = 1,
						max = 100,
						min = 0,
						tooltip = "The percent of HP to use Healing Wave at",
					},
				},					
				{ 	name = "UE Tank",
					enable = false,
					tooltip = "Enables the use of Unleash Elements on Tanks priority",
				},					
				{ 	name = "Unleash Elements",
					enable = true,
					tooltip = "Enables the use of Unleash Elements",
					widget = { type = 'numBox',
						value = 90,
						step = 1,
						max = 100,
						min = 0,
						tooltip = "The percent of HP to use Unleash Elements at",
					},
				},			
			},
			hotkeys = {
				{	name = "Pause Rotation",			enable = true,	hotkeys = {'ls'},	},
				{	name = "Healing Tide Totem",					enable = true,	hotkeys = {'rs'},	
					tooltip = "Pop Healing Tide Totem", },
				{	name = "Healing Rain Mouseover",	enable = false,	hotkeys = {'la'},	
					tooltip = "Auto drop Healing Rain at mouseover", },
				{	name = "Healing Rain",				enable = true,	hotkeys = {'ra'},	
					tooltip = "Use Healing Rain at mouseover", },
				{	name = "Ascendance",				enable = true,	hotkeys = {'rc'},	
					tooltip = "Pop Ascendance", },					
				{	name	= "Adding Players CT",		enable	= true,	hotkeys	= {'ls', 'la'},
					tooltip = "Adding Players to Custom Table", },	
				{	name	= "Removing Players CT",	enable	= true,	hotkeys	= {'ls', 'lc'},
					tooltip = "Removing Players from Custom Table", },						
			},
		}
		PQI_Healing_Resto_Shaman_GUI_Loaded = PQI:AddRotation(config)
	end
	if VaSpec ~= 264 then
		VaSpec = 264
		PQR_RotationChanged("Vachiusa Resto Shaman")
	end

	-- Variables
	if PQI_General_Resto_Shaman_GUI_Loaded and PQI_CD_Resto_Shaman_GUI_Loaded and PQI_Healing_Resto_Shaman_GUI_Loaded then
		
		PQI_Variables_Loaded = PQI_VachiusaGeneralRestoShaman_AutoOpenPQIOptions_enable
		VachiusaRestoShaman_AutoOpenPQIOptions_enable = PQI_VachiusaGeneralRestoShaman_AutoOpenPQIOptions_enable

		Vasa_RiptideCheck = PQI_VachiusaHealingRestoShaman_Riptide_enable
		Vasa_Riptide = PQI_VachiusaHealingRestoShaman_Riptide_value
		Vasa_RiptideTankCheck = PQI_VachiusaHealingRestoShaman_RiptideTank_enable
		Vasa_RiptideTank = PQI_VachiusaHealingRestoShaman_RiptideTank_value
		Vasa_HealingSurgeCheck = PQI_VachiusaHealingRestoShaman_HealingSurge_enable
		Vasa_HealingSurge = PQI_VachiusaHealingRestoShaman_HealingSurge_value
		Vasa_HealingSurgeTankCheck = PQI_VachiusaHealingRestoShaman_HealingSurgeTank_enable
		Vasa_HealingSurgeTank = PQI_VachiusaHealingRestoShaman_HealingSurgeTank_value
		Vasa_GreaterHealingWaveCheck = PQI_VachiusaHealingRestoShaman_GreaterHealingWave_enable
		Vasa_GreaterHealingWave = PQI_VachiusaHealingRestoShaman_GreaterHealingWave_value
		Vasa_HealingWaveCheck = PQI_VachiusaHealingRestoShaman_HealingWave_enable
		Vasa_HealingWave = PQI_VachiusaHealingRestoShaman_HealingWave_value
		Vasa_UETankCheck = PQI_VachiusaHealingRestoShaman_UETank_enable
		Vasa_UnleashElementsCheck = PQI_VachiusaHealingRestoShaman_UnleashElements_enable
		Vasa_UnleashElements = PQI_VachiusaHealingRestoShaman_UnleashElements_value
			
		Vasa_SpiritWalkerGraceCheck = PQI_VachiusaCDRestoShaman_SpiritWalkerGrace_enable
		Vasa_SpiritWalkerGrace = PQI_VachiusaCDRestoShaman_SpiritWalkerGrace_value
		Vasa_ManaTideCheck = PQI_VachiusaCDRestoShaman_ManaTide_enable
		Vasa_ManaTide = PQI_VachiusaCDRestoShaman_ManaTide_value
		Vasa_ChainHealCheck = PQI_VachiusaCDRestoShaman_ChainHeal_enable
		Vasa_ChainHeal = PQI_VachiusaCDRestoShaman_ChainHeal_value
		Vasa_ChainHealLimitCheck = PQI_VachiusaCDRestoShaman_ChainHealLimit_enable
		Vasa_ChainHealLimit = PQI_VachiusaCDRestoShaman_ChainHealLimit_value
		Vasa_PrimalElementalistCheck = PQI_VachiusaCDRestoShaman_PrimalElementalist_enable
		Vasa_PrimalElementalist = PQI_VachiusaCDRestoShaman_PrimalElementalist_value
		Vasa_PrimalElementalistLimitCheck = PQI_VachiusaCDRestoShaman_PrimalElementalistLimit_enable
		Vasa_PrimalElementalistLimit = PQI_VachiusaCDRestoShaman_PrimalElementalistLimit_value
		Vasa_PrimalElementalistBuffsOnlyCheck = PQI_VachiusaCDRestoShaman_PrimalElementalistBuffsOnly_enable		
		Vasa_AutoTargetCheck = PQI_VachiusaGeneralRestoShaman_AutoTarget_enable
		Vasa_AutoTarget = PQI_VachiusaGeneralRestoShaman_AutoTarget_value
		Vasa_FixTankESCheck = PQI_VachiusaGeneralRestoShaman_FixTankES_enable
		Vasa_FixTankES = PQI_VachiusaGeneralRestoShaman_FixTankES_value
		Vasa_SpiritLinkTotemCheck = PQI_VachiusaGeneralRestoShaman_SpiritLinkTotem_enable
		Vasa_SpiritLinkTotem = PQI_VachiusaGeneralRestoShaman_SpiritLinkTotem_value
		Vasa_DPSTotemCheck = PQI_VachiusaGeneralRestoShaman_DPSTotem_enable
		Vasa_DPSTotem = PQI_VachiusaGeneralRestoShaman_DPSTotem_value
		Vasa_LightningBoltCheck = PQI_VachiusaGeneralRestoShaman_LightningBolt_enable
		Vasa_LightningBolt = PQI_VachiusaGeneralRestoShaman_LightningBolt_value
		Vasa_ForceLightningBoltCheck = PQI_VachiusaGeneralRestoShaman_ForceLightningBolt_enable
		Vasa_ForceLightningBolt = PQI_VachiusaGeneralRestoShaman_ForceLightningBolt_value		
		Vasa_DPSCheck = PQI_VachiusaGeneralRestoShaman_DPS_enable
		Vasa_DPS = PQI_VachiusaGeneralRestoShaman_DPS_value
		Vasa_PurifySpiritCheck = PQI_VachiusaGeneralRestoShaman_PurifySpirit_enable
		Vasa_PurifySpirit = PQI_VachiusaGeneralRestoShaman_PurifySpirit_value
		Vasa_LowManaCheck = PQI_VachiusaGeneralRestoShaman_LowMana_enable
		Vasa_LowMana = PQI_VachiusaGeneralRestoShaman_LowMana_value
		Vasa_RacialsCheck = PQI_VachiusaGeneralRestoShaman_Racials_enable
		Vasa_Racials = PQI_VachiusaGeneralRestoShaman_Racials_value
		Vasa_4xEventsCheck = PQI_VachiusaGeneralRestoShaman_4xEvents_enable
		Vasa_4xEvents = PQI_VachiusaGeneralRestoShaman_4xEvents_value
		Vasa_53EventsCheck = PQI_VachiusaGeneralRestoShaman_53Events_enable
		Vasa_53Events = PQI_VachiusaGeneralRestoShaman_53Events_value
		Vasa_54EventsCheck = PQI_VachiusaGeneralRestoShaman_54Events_enable
		Vasa_54Events = PQI_VachiusaGeneralRestoShaman_54Events_value	
		Vasa_SpecialEvents = PQI_VachiusaGeneralRestoShaman_SpecialEvents_enable	
		Vasa_AutoEventDispel = PQI_VachiusaGeneralRestoShaman_AutoEventDispel_enable
		Vasa_QueueSysCheck = PQI_VachiusaGeneralRestoShaman_QueueSys_enable
		Vasa_QueueSys = PQI_VachiusaGeneralRestoShaman_QueueSys_value	
		Vasa_Mouseover = PQI_VachiusaGeneralRestoShaman_MouseoverHeal_enable
		Vasa_TargetHeal = PQI_VachiusaGeneralRestoShaman_TargetHeal_enable
		Vasa_NPCMouseoverHeal = PQI_VachiusaGeneralRestoShaman_NPCMouseoverHeal_enable
		Vasa_PetHeal = PQI_VachiusaGeneralRestoShaman_PetHeal_enable
		Vdebug = PQI_VachiusaGeneralRestoShaman_Vdebug_enable
		Vasa_StopCasting = PQI_VachiusaGeneralRestoShaman_StopCasting_enable
		
		if Vasa_LowHP == nil then Vasa_LowHP = 80 end
		if Vasa_ActualHP == nil or Vasa_ActualHP then Vasa_ActualHP = false end
		
		-- Hotkeys
		if not PQI_Hotkeys_Functions_Set then
			function PQI_PauseRotation()
				if PQI_VachiusaHealingRestoShaman_PauseRotation_enable and PQI:IsHotkeys(PQI_VachiusaHealingRestoShaman_PauseRotation_key) then
				return true else return false 
			end	end
			function PQI_HealingTideTotem()
				if PQI_VachiusaHealingRestoShaman_HealingTideTotem_enable and PQI:IsHotkeys(PQI_VachiusaHealingRestoShaman_HealingTideTotem_key) then
				return true else return false
			end	end		
			function PQI_HealingRainMouseover()
				if PQI_VachiusaHealingRestoShaman_HealingRainMouseover_enable and PQI:IsHotkeys(PQI_VachiusaHealingRestoShaman_HealingRainMouseover_key) then
				return true else return false
			end	end	
			function PQI_HealingRain()
				if PQI_VachiusaHealingRestoShaman_HealingRain_enable and PQI:IsHotkeys(PQI_VachiusaHealingRestoShaman_HealingRain_key) then
				return true else return false
			end	end	
			function PQI_Ascendance()
				if PQI_VachiusaHealingRestoShaman_Ascendance_enable and PQI:IsHotkeys(PQI_VachiusaHealingRestoShaman_Ascendance_key) then
				return true else return false
			end	end
			function PQI_AddingPlayersCT()
				if PQI_VachiusaHealingRestoShaman_AddingPlayersCT_enable and PQI:IsHotkeys(PQI_VachiusaHealingRestoShaman_AddingPlayersCT_key) then
				return true else return false
			end	end	
			function PQI_RemovingPlayersCT()
				if PQI_VachiusaHealingRestoShaman_RemovingPlayersCT_enable and PQI:IsHotkeys(PQI_VachiusaHealingRestoShaman_RemovingPlayersCT_key) then
				return true else return false
			end	end			
		end	
		
		Vasa_PauseRotationCheck = PQI_VachiusaHealingRestoShaman_PauseRotation_enable
		Vasa_HealingTideTotemCheck = PQI_VachiusaHealingRestoShaman_HealingTideTotem_enable
		Vasa_HealingRainMouseoverCheck = PQI_VachiusaHealingRestoShaman_HealingRainMouseover_enable
		Vasa_HealingRainCheck = PQI_VachiusaHealingRestoShaman_HealingRain_enable
		Vasa_AscendanceCheck = PQI_VachiusaHealingRestoShaman_Ascendance_enable	
		Vasa_AddingPlayersCTCheck = PQI_VachiusaHealingRestoShaman_AddingPlayersCT_enable
		Vasa_RemovingPlayersCTCheck = PQI_VachiusaHealingRestoShaman_RemovingPlayersCT_enable
		
		VachiusaRestoShaman_PauseRotation_key = PQI_PauseRotation()
		VachiusaRestoShaman_HealingTideTotem_key = PQI_HealingTideTotem()
		VachiusaRestoShaman_HealingRainMouseover_key = PQI_HealingRainMouseover()
		VachiusaRestoShaman_HealingRain_key = PQI_HealingRain()
		VachiusaRestoShaman_Ascendance_key = PQI_Ascendance()	
		VachiusaRestoShaman_AddingPlayersCT_key = PQI_AddingPlayersCT()
		VachiusaRestoShaman_RemovingPlayersCT_key = PQI_RemovingPlayersCT()	

		--Set PQI
		if not PQI_VachiusaRestoShaman_Set and VachiusaRestoShaman_AutoOpenPQIOptions_enable ~= nil then
			VAS_RunMacroText("/PQI show")
			VAS_RunMacroText("/PQI config show")
			VAS_RunMacroText("/PQI config width 220")
			if not VachiusaRestoShaman_AutoOpenPQIOptions_enable then
			VAS_RunMacroText("/PQI config hide") end
			PQI_VachiusaRestoShaman_Set = true
		end
	end

	
	if PQI_Variables_Loaded == nil then
		if not VSIWarning2 then
			VAS_WriteToChat("\124cFFFF55FFWarning: something wrong with VSI addon!")
			VSIWarning2 = true
		end
		return true
	end

	if not VAS_RotationStarted then
		if UnitLevel("player") ~= 90 then
			VAS_WriteToChat("\124cFFFF55FFWarning: only takes full effect when we're 90!")	
			return true --added
		end	
		QueueSystem()
		VAS_RotationStarted = true
	end

	if UnitBuffID("player", 79206) then --Spiritwalker's Grace
		Vasa_Moving = false
	elseif VAS_Moving("player") then
		Vasa_Moving = true
	else
		Vasa_Moving = false
	end

	-- Custom Table --
	--------------------------------------
	-- Adding Players to Custom Table
	--------------------------------------
	if Vasa_AddingPlayersCTCheck then
		if VachiusaRestoShaman_AddingPlayersCT_key
		and not GetCurrentKeyBoardFocus()
		and UnitExists("mouseover")
		and ( CanHeal("mouseover") 
		or UnitIsUnit("player", "mouseover") ) then  
			for i=1, #Vasa_CustomT do
				if Vasa_CustomT[i].GUID and Vasa_CustomT[i].GUID == UnitGUID("mouseover") then
					return false
				end
			end
			
			table.insert(Vasa_CustomT, { GUID = UnitGUID("mouseover") } )
			
			if not GetCVarBool("Vasa_Recording") then
				VAS_WriteToChat("We just added "..UnitName("mouseover").." to the Custom Healing Table.", "Alert")
			end
			return true
		
		end
	end

	--------------------------------------
	-- Removing Players from Custom Table
	--------------------------------------
	if Vasa_RemovingPlayersCTCheck then
		if VachiusaRestoShaman_RemovingPlayersCT_key
		and not GetCurrentKeyBoardFocus() 
		and UnitExists("mouseover")
		and ( CanHeal("mouseover") 
		or UnitIsUnit("player", "mouseover") )then
			for i=1, #Vasa_CustomT do
				if Vasa_CustomT[i].GUID and Vasa_CustomT[i].GUID == UnitGUID("mouseover") then
					if not GetCVarBool("Vasa_Recording") then
						VAS_WriteToChat("We just removed "..UnitName(Vasa_CustomT[i].Unit).." from the Custom Healing Table.", "Alert")
					end
					table.remove(Vasa_CustomT, i)
					return true
				end
			end
		end
	end

	-- Pause
	if (VachiusaRestoShaman_PauseRotation_key and not GetCurrentKeyBoardFocus())
	 or UnitIsDeadOrGhost("player") 
	 or IsMounted() 
	 or (UnitBuffID("player",2645) and Vasa_Moving) --Ghost Wolf
	 or UnitBuffID("player", 104269) then --drink 
		if PQI_VachiusaGeneral_RotationEngine_value == 4 then
			raidfu = nil
			vicon = nil
			CompactRaidFrameContainer_ApplyToFrames(CompactRaidFrameContainer, "normal", VAS_UpdateIcon)
		elseif PQI_VachiusaGeneral_RotationEngine_value == 7 and not UnitCastingInfo("player") then
			raidfu = nil
			vicon = nil
			HealBot_OnEvent_VachiusaUpdate(vicon,raidfu)
		elseif PQI_VachiusaGeneral_RotationEngine_value == 8 and not UnitCastingInfo("player") then
			raidfu = nil
			vicon = nil
			ElvUF_OnEvent_VachiusaUpdate(vicon,raidfu)	
		end
		return true
	end

	-- Healing Engine --
	if Vasa_54EventsCheck then
		if not UnitDebuffID("player",144850) --Test of Reliance
		and not UnitDebuffID("player",142861) then --Ancient Miasma
			SheuronEngine(Vasa_Mouseover, Vasa_LowHP, Vasa_ActualHP, Vasa_TargetHeal, Vasa_SpecialEvents, Vasa_PetHeal)  -- Deactivate Mouseover  ||   At what % Health do we consider someone LowHP  ||  Sort by Actual Health = true
		end
	else
		SheuronEngine(Vasa_Mouseover, Vasa_LowHP, Vasa_ActualHP, Vasa_TargetHeal, Vasa_SpecialEvents, Vasa_PetHeal)  -- Deactivate Mouseover  ||   At what % Health do we consider someone LowHP  ||  Sort by Actual Health = true	
	end


	if GetCVarBool("PQ_UseCustomT") then
		members = Vasa_CustomT
		lowhpmembers = 0
		for i=1, #Vasa_CustomT do
			if Vasa_CustomT[i].HP < 80 then
				lowhpmembers = lowhpmembers + 1
			end
		end
		
		table.sort(members, function(x,y) return x.HP < y.HP end)
	end

	local _,earth = GetTotemInfo(2)

	if Vasa_UnitInfo("player") <= 30 
	and UnitAffectingCombat("player") then	
		if GetItemCount(5512,false,true) > 0	
		and VAS_SpellAvailable(5512) --Healthstone		
		and GetItemCooldown(5512) == 0
		then
			if UnitCastingInfo("player") then
				VAS_SpellStopCasting()
			end		
			VAS_UseItemByName(5512)
			VAS_WriteToChat("\124cFFFF55FFHealthstone - HP: "..Vasa_UnitInfo("player")) 
			return true
		elseif VAS_SpellAvailable(108270) --Stone Bulwark Totem
		and earth == ""
		and select(2,GetTalentRowSelectionInfo(1)) == 2 --check talent
		and IsUsableSpell(108270)
		--and GetSpellCooldown(108270) == 0	
		and not Vasa_Moving then
			if UnitCastingInfo("player") then
				VAS_SpellStopCasting()
			end		
			VAS_Cast(108270,nil)	
			--VAS_WriteToChat("\124cFFFF55FFStone Bulwark Totem - HP: "..Vasa_UnitInfo("player")) 
			return true		
		elseif earth == ""
		and lowhpmembers < 5
		and IsUsableSpell(2062) --Earth Elemental Totem
		and not UnitCastingInfo("player")
		and VAS_SpellAvailable(2062) then   
			VAS_Cast(2062,nil)	
			--VAS_WriteToChat("\124cFFFF55FFEarth Elemental Totem - HP: "..Vasa_UnitInfo("player")) 
			return true 
		end
	end

	if Vasa_RacialsCheck
	and UnitAffectingCombat("player") then

		local PQ_Class = select(2, UnitClass("player")) 
		
		--Draenei 
		local GiftOfTheNaaru = 59542	
		--Blood Elf
		local ArcaneTorrent = 28730 --mana regen
		
		if PQ_Class == "PALADIN" then
			GiftOfTheNaaru = 59542	
		elseif PQ_Class == "MONK" then 
			GiftOfTheNaaru = 121093
			ArcaneTorrent = 129597 --chi regen
		elseif PQ_Class == "PRIEST" then  
			GiftOfTheNaaru = 59544
		elseif PQ_Class == "SHAMAN" then 
			GiftOfTheNaaru = 59547
		end

		--Troll 
		local Berserking = 26297 
		--Undead
		local WillOfTheForsaken = 7744  
		--Dwarven 
		local Stoneform = 20594 
		--Human 
		local EveryManForHimself = 59752
		--Undead 
		--local Cannibalize = 20577 --not much helpful
		--Orc 
		local BloodFury = 33702
		--Gloves Engineer
		local _, GECooldown, GEReady = GetInventoryItemCooldown("player", 10)
				
		--HP
		if IsSpellKnown(GiftOfTheNaaru) 
		--and GetSpellCooldown(GiftOfTheNaaru) == 0 
		and VAS_SpellAvailable(GiftOfTheNaaru)
		and Vasa_UnitInfo("player") <= 30	
		then		
			VAS_Cast(GiftOfTheNaaru,nil)	 
			return true 
		end
		
		--Mana
		if IsSpellKnown(ArcaneTorrent) 
		and PQ_Class ~= "MONK"
		--and GetSpellCooldown(ArcaneTorrent) == 0 
		and VAS_SpellAvailable(ArcaneTorrent)
		and select(3, Vasa_UnitInfo("player")) <= 80	
		then		
			VAS_Cast(ArcaneTorrent,nil)	 
			return true 
		end	
		
		--CDs
		if not racialcds then
			function racialcds()
				if IsSpellKnown(BloodFury) 
				--and GetSpellCooldown(BloodFury) == 0 
				and VAS_SpellAvailable(BloodFury)	
				then		
					VAS_Cast(BloodFury,nil)	 
					return true 
				elseif IsSpellKnown(Berserking) 
				--and GetSpellCooldown(Berserking) == 0 
				and VAS_SpellAvailable(Berserking)	
				then		
					VAS_Cast(Berserking,nil)	 
					return true 
				elseif GECooldown == 0 
				and GEReady == 1 then
					VAS_UseInventoryItem(10)
				end
			end
		end
		
		if lowhpmembers >=5 then
			racialcds()
		end
		
		--Removes any Charm, Fear and Sleep effect
		if not GotFear then
			function GotFear(t) 
				local debuff = { 10326, 8122, 2094, 5782, 5484, 6358, 5246 }
				for i=1, #debuff do if UnitDebuffID(t,debuff[i]) then return true end end
			end
		end
		if IsSpellKnown(WillOfTheForsaken) 
		--and GetSpellCooldown(WillOfTheForsaken) == 0 
		and VAS_SpellAvailable(WillOfTheForsaken)	
		and GotFear("player")
		then		
			VAS_Cast(WillOfTheForsaken,nil)	 
			return true 
		end  
		
		--Removes all poison, disease and bleed effects and reduces all damage taken by 10% for 8 sec
		if not GotPoison then
			function GotPoison(t)
				local i, debuff = 1, select(5,UnitDebuff(t, 1)) 
				while debuff do
					if debuff == "Poison" or debuff == "Disease" then return true end
					i = i + 1 debuff = select(5,UnitDebuff(t, i)) 
				end
			end
		end	
		if IsSpellKnown(Stoneform) 
		--and GetSpellCooldown(Stoneform) == 0 
		and VAS_SpellAvailable(Stoneform)	
		and GotPoison("player")
		then		
			VAS_Cast(Stoneform,nil)	 
			return true 
		end    	
		
		--Removes all movement impairing effects and all effects which cause loss of control of your character
		if not LostControl then
			function LostControl(t) 
				local debuff = { 122, 10326, 8122, 2094, 5782, 5484, 6358, 5246, 408 }
				for i=1, #debuff do if UnitDebuffID(t,debuff[i]) then return true end end
			end
		end  
		if IsSpellKnown(EveryManForHimself) 
		--and GetSpellCooldown(EveryManForHimself) == 0 
		and VAS_SpellAvailable(EveryManForHimself)	
		and LostControl("player")
		then		
			VAS_Cast(EveryManForHimself,nil)	 
			return true 
		end		
	end

	if Vasa_54EventsCheck 
	and UnitAffectingCombat("player") then
		local boss,bossid = bossid()
		local dispelid = 51886	
		local purgeid = 370	
		local rangecheckid = 331
		local buff = { }
		stopcasting = false
		stopfade = false
		stopdps = false
		LLdebuff = false
		LLdebuffunit = false
		if UnitExists(boss) then
			--local _, _, rdifficulty = GetInstanceInfo()
			if bossid == 71515 then --General Nazgrim
				if UnitBuffID("boss1", 143593) then --Defensive Stance
					stopdps = true				
				else
					stopdps = false
				end
			elseif bossid == 71995 or bossid == 71996 or bossid == 72000 then --Amalgam of Corruption - Norushen
				if UnitDebuffID("player",144850) --Test of Reliance
				then 
					BossSheuronEngine(Vasa_Mouseover, Vasa_LowHP, Vasa_ActualHP, Vasa_TargetHeal, 3, true, rangecheckid)  -- Deactivate Mouseover  ||   At what % Health do we consider someone LowHP  ||  Sort by Actual Health = true
					local buff  = { 144514 } --Lingering Corruption
					RaidDispel(dispelid,buff) 	
				end
			elseif bossid == 71475 or bossid == 71479 or bossid == 71480 then --The Fallen Protectors
				local buff  = { 143434 } --Shadow Word: Bane
				RaidDispel(dispelid,buff) 	
			elseif bossid == 71734 then --Sha of Pride
				if UnitDebuffID("player",144359) then
					local buff  = { 144351 } --Mark of Arrogance
					RaidDispel(dispelid,buff) 			
				end
			elseif bossid == 71454 then --Malkorok	
				local buff  = { 142913 } 	
				RaidRangeDispel(dispelid,buff,8) 	
				if UnitDebuffID("player",142861) then --Ancient Miasma			
					ShieldSheuronEngine(Vasa_Mouseover, Vasa_LowHP, Vasa_ActualHP, Vasa_TargetHeal, Vasa_PetHeal)  -- Deactivate Mouseover  ||   At what % Health do we consider someone LowHP  ||  Sort by Actual Health = true					
				end
			elseif bossid == 71161 and PQI_VachiusaGeneral_RotationEngine_value ~= 4 and PQI_VachiusaGeneral_RotationEngine_value ~= 7 and PQI_VachiusaGeneral_RotationEngine_value ~= 8 then --Kil'ruk the Wind-Reaver - Paragons of the Klaxxi
				if UnitDebuffID("player",141858) then --Ingenious			
					if not tIngenious or (#tIngenious > 0 and (GetTime() > tIngenious[1].Time + 30)) then
						tIngenious = { }						
						local qTime = GetTime() 
						local lastmax = 0
						local maxunit = "player"		
						local lasttype = "notype"						
						local ClassList = { {'WARRIOR', 0 }, {'PALADIN', 0 }, {'HUNTER', 0 }, {'ROGUE', 0 }, {'PRIEST', 0 }, {'DEATHKNIGHT', 0 }, {'SHAMAN', 0 }, {'MAGE', 0 }, {'WARLOCK', 0 }, {'MONK', 0 }, {'DRUID', 0 } }				
						local RaceList = { {'Draenei', 0 }, {'Gnome', 0 }, {'Human', 0 }, {'NightElf', 0 }, {'Worgen', 0 }, {'Pandaren', 0 }, {'BloodElf', 0 }, {'Goblin', 0 }, {'Orc', 0 }, {'Tauren', 0 }, {'Troll', 0 }, {'Scourge', 0 } }
						for i=1,25 do
							local unitCheck = "raid"..i
							  if UnitExists(unitCheck) and UnitIsPlayer(unitCheck) then
							local _, unitClass = UnitClass(unitCheck)					  	
							local _, unitRace = UnitRace(unitCheck)					  	
							if unitClass and UnitRace then	
									--Class
									for j=1, #ClassList do
										if unitClass == ClassList[j][1] then
											VAS_WriteToChat("Debug1 - Num: " ..ClassList[j][2].." - Class: " ..ClassList[j][1])
											ClassList[j][2] = ClassList[j][2] + 1
											if ClassList[j][2] > lastmax then
												lastmax = ClassList[j][2]
												maxunit = unitCheck
												lasttype = ClassList[j][1]
											end												
										end		
									end
									--Race
									for j=1, #RaceList do
										if unitRace == RaceList[j][1] then
											VAS_WriteToChat("Debug1 - Num: " ..RaceList[j][2].." - Race: " ..RaceList[j][1])
											RaceList[j][2] = RaceList[j][2] + 1
											if RaceList[j][2] > lastmax then
												lastmax = RaceList[j][2]
												maxunit = unitCheck
												lasttype = RaceList[j][1]
											end												
										end		
									end
							end				             	
							  end
						end				
						VAS_WriteToChat("Debug1 - Unit: " ..maxunit.." - Type: " ..lasttype.." - Total: " ..lastmax.." - Time: " ..qTime)		
						table.insert(tIngenious, { Unit = maxunit, Type = lasttype, Total = lastmax, Time = qTime } )
						return true								
					else
						if #tIngenious > 0 then			
							if UnitExists(tIngenious[1].Unit) 
							and IsSpellInRange(GetSpellInfo(rangecheckid),tIngenious[1].Unit) == 1
							and CanHeal(tIngenious[1].Unit) then	
							VAS_TargetUnit(tIngenious[1].Unit) 
						--Press the ExtraActionButton 
						VAS_RunMacroText("/click ExtraActionButton1")                     
						VAS_RunMacroText("/targetlasttarget")
						VAS_WriteToChat("Ingenious Name: "..UnitName(tIngenious[1].Unit).." - Type: "..tIngenious[1].Type.." - Total: "..tIngenious[1].Total.." - Time: "..tIngenious[1].Time)							      						      		 	
							end
						end				
					end   				
				else
					tIngenious = false
				end
			elseif bossid == 71529 then --Thok the Bloodthirsty
				local buff  = { 143791 } --Corrosive Blood
				RaidDispel(dispelid,buff) 
				local DeafeningScreech = GetSpellInfo(143343) --Deafening Screech
				local bossCasting,_,_,_,_,castEnd = UnitCastingInfo(boss) 
				if (bossCasting == DeafeningScreech) then
					stopcasting = true
				end							
			end	
		end
	end

	-- QueueSys
	if Vasa_QueueSysCheck 
	then
		local dispelid2 = 77130	
		local dispelid = 51886	
		local purgeid = 370	
		local rangecheckid = 331
		if #Queue_Sys > 0 then	
			if VAS_SpellAvailable(dispelid) 
			and select(2,GetSpellCooldown(dispelid2)) < 2
			and UnitExists(Queue_Sys[1].Unit)
			and IsUsableSpell(dispelid)
			and IsSpellInRange(GetSpellInfo(dispelid),Queue_Sys[1].Unit) == 1
			and CanHeal(Queue_Sys[1].Unit)
			and not VAS_IsOutOfSight(Queue_Sys[1].Unit) then
				if not UnitChannelInfo("player")
				and not UnitCastingInfo("player") 
				then	
					VAS_Cast(dispelid,Queue_Sys[1].Unit)				
					return true	
				end
			end
		end
		
		if Queue_Spell then
			if #Queue_Spell > 0 then	
				if GetTime() - Queue_Spell[1].Time >= 10 then
					VAS_WriteToChat("Removed expired queue "..Queue_Spell[1].SpellID)
					Queue_Spell = { }				
					return true
				end			
				if #Queue_Spell > 1 then			
					if Queue_Spell[1].SpellID == Queue_Spell[2].SpellID and Queue_Spell[1].Unit == Queue_Spell[2].Unit then
						VAS_WriteToChat("Removed dup queue "..Queue_Spell[1].SpellID)
						table.remove(Queue_Spell,2)	
						return true	
					end
				end
				
				local qunit = "player"
				if Queue_Spell[1].Unit == "low" then
					qunit = members[1].Unit
				elseif Queue_Spell[1].Unit == "tank" then
					if #Vasa_Tanks > 0 then
						for i=1, #Vasa_Tanks do
							if UnitThreatSituation(Vasa_Tanks[i].Unit) then
								qunit = Vasa_Tanks[i].Unit
								break
							end
						end
					end
					if UnitThreatSituation(members[1].Unit)	== 3 then
						qunit = members[1].Unit
					end			
				else
					qunit = Queue_Spell[1].Unit
				end
				
				if VAS_SpellAvailable(tonumber(Queue_Spell[1].SpellID)) 
				and ((select(2,GetSpellCooldown(tonumber(Queue_Spell[1].SpellID))) < 2
				and Queue_Spell[1].SpellID ~= 51886)
				or (select(2,GetSpellCooldown(tonumber(dispelid2))) < 2
				and Queue_Spell[1].SpellID == 51886))
				and UnitExists(qunit)
				then
					if not UnitChannelInfo("player")
					and not UnitCastingInfo("player") 
					then					
						local qmembers = members
						table.sort(qmembers, function(x) return UnitIsUnit(qunit,x.Unit) end)
						if UnitIsUnit(qmembers[1].Unit,qunit) then
							qunit = qmembers[1].Unit	
						else
							if IsSpellInRange(GetSpellInfo(Queue_Spell[1].SpellID),Queue_Spell[1].Unit) then
								qunit = Queue_Spell[1].Unit	
							else
								qunit = "player"				
							end
						end
						SpellSUCCEEDED(Queue_Spell[1].SpellID,qunit)
						VAS_Cast(Queue_Spell[1].SpellID,qunit)									
						return true						
					end
				end						
			end
		end	
	end

	--HealingRainMouseover toggle function
	if Vasa_HealingRainMouseoverCheck then
		if not HRMMode then HRMMode = false end
		if not HRMModetimer then HRMModetimer = 0 end
		if (VachiusaRestoShaman_HealingRainMouseover_key and not GetCurrentKeyBoardFocus()) and GetTime() - HRMModetimer > 1 then
			HRMModetimer = GetTime()	
			if HRMMode then
				HRMMode = false
				print("|cff347C2CHealing Rain at Mouseover Mode: |cffDC143COff|cffffffff")
			else
				HRMMode = true
				print("|cff347C2CHealing Rain at Mouseover Mode: |cff79BAECOn|cffffffff")		
			end
		end
	end

	--NPCMouseoverHeal
	if Vasa_NPCMouseoverHeal
	and UnitAffectingCombat("player")
	then
		local dispelid = 51886	
		local purgeid = 370	
		local rangecheckid = 331	
		if UnitExists("mouseover")				
		and not UnitIsPlayer("mouseover") then
			local npcID = tonumber(UnitGUID("mouseover"):sub(6,10), 16) 				
			if npcID == 71604 --Contaminated Puddle - Immerseus - SoO
			or npcID == 71995 or npcID == 71996 or npcID == 72000 --Norushen
			or npcID == 71357 --Wrathion 
			then				
				if IsSpellInRange(GetSpellInfo(rangecheckid),"mouseover") --HealingWave
				and Vasa_UnitInfo("mouseover") < 100 then													
					if VAS_SpellAvailable(8004) 	
					and not UnitCastingInfo("player")	
					and select(3, Vasa_UnitInfo("player")) > 70
					and IsUsableSpell(8004) then
						VAS_Cast(8004,"mouseover")	 			 			
						--VAS_WriteToChat("\124cFFFF55FFCast HSurge - Name: " ..UnitName("mouseover").." - HP: "..Vasa_UnitInfo("mouseover").." - NPCID: "..npcID) 	
						return true
					end		
			
					if VAS_SpellAvailable(77472) 
					and not UnitCastingInfo("player")
					and IsUsableSpell(77472) then
						VAS_Cast(77472,"mouseover")	 
						--VAS_WriteToChat("\124cFFFF55FFCast GHW - Name: " ..UnitName("mouseover").." - HP: "..Vasa_UnitInfo("mouseover").." - NPCID: "..npcID) 
						return true
					end							
				end
			end		
		elseif UnitExists("focus")				
		and not UnitIsPlayer("focus") then
			local npcID = tonumber(UnitGUID("focus"):sub(6,10), 16) 				
			if npcID == 71604 --Contaminated Puddle - Immerseus - SoO
			or npcID == 71995 or npcID == 71996 or npcID == 72000 --Norushen
			or npcID == 71357 --Wrathion 
			then
				if IsSpellInRange(GetSpellInfo(rangecheckid),"focus") --FlashHeal
				then		
					local focushp = CalculateHP("focus")
					if focushp ~= nil and select(2, CalculateHP("focus")) ~= nil then
						table.insert(members, { Unit = "focus", HP = focushp, AHP = select(2, CalculateHP("focus")), IsNPC = true } )
					end
					if #members > 0 then
						table.sort(members, function(x,y) return x.HP < y.HP end)
					end				
				end
			end	
		end
	end

	if 100 * UnitPower("player") / UnitPowerMax("player") <= 50
	and not UnitCastingInfo("player")
	and not UnitAffectingCombat("player") 
	and VAS_SpellAvailable(80618) --Mage cookies	
	and not UnitBuffID("player", 104269)
	and not Vasa_Moving 
	and GetItemCount(80618,false,true) > 0
	and GetItemCooldown(80618) == 0 then
		VAS_UseItemByName(80618)
		VAS_WriteToChat("\124cFFFF55FFMage cookies - HP: " ..Vasa_UnitInfo("player")) 
		return true
	end

	--Stop Casting
	if Vasa_StopCasting then
		if UnitExists("boss1") then
			local npcid = tonumber(UnitGUID("boss1" ):sub(6,10), 16)
		else
			local npcid = 0
		end
		
		local _,fire = GetTotemInfo(1)
		local _,earth = GetTotemInfo(2)
		local _,air = GetTotemInfo(4)
		local _, water, waterstartTime, waterduration = GetTotemInfo(3)
		local waterest_dur = waterstartTime+waterduration-GetTime()
		
		if SpellIsTargeting() then
			VAS_SpellStopCasting()
		elseif UnitAffectingCombat("player") 
		and ((UnitCastingInfo("player") == GetSpellInfo(331)) --HealingWave
		or ((UnitCastingInfo("player") == GetSpellInfo(403)) and select(3, Vasa_UnitInfo("player")) > 30)) --LightningBolt
		and not IsLeftControlKeyDown() 
		and (CalStop(members[1].Unit) < 40 or (lowhpmembers > 3 and CalStop(members[1].Unit) < 70)) 
		and select(3, Vasa_UnitInfo("player")) >= 12 --prevent stop loop
		and IsUsableSpell(8004) then --prevent stop loop
			VAS_SpellStopCasting() 
			--VAS_WriteToChat("\124cFFFF55FFStop Casting HealingWave/LightningBolt - HP: " ..members[1].HP) 		
			return true 
		elseif UnitAffectingCombat("player") 
		and (UnitCastingInfo("player") == GetSpellInfo(331)) --HealingWave
		and IsSpellInRange(GetSpellInfo(331),members[1].Unit) == 1
		and CalStop(members[1].Unit) > Vasa_LightningBolt and CalStop(members[1].Unit) > 95 then
			VAS_SpellStopCasting() 
			--VAS_WriteToChat("\124cFFFF55FFStop Cast HealingWave - Name: " ..UnitName(members[1].Unit).." - Current HP: "..CalStop(members[1].Unit).." - overheal: "..select(2, CalStop(members[1].Unit)))	
			return true 
		elseif (UnitCastingInfo("player") == GetSpellInfo(77472)) --GreaterHealingWave
		and IsSpellInRange(GetSpellInfo(77472),members[1].Unit) == 1
		and not UnitIsUnit("boss1",members[1].Unit)
		and CalStop(members[1].Unit) > Vasa_GreaterHealingWave and CalStop(members[1].Unit) > Vasa_LightningBolt 
		and UnitAffectingCombat("player") then 
			if npcid ~= 62442 and npcid ~= nil then --Tsulong
				VAS_SpellStopCasting() 
				VAS_WriteToChat("\124cFFFF55FFStop Casting GreaterHealingWave - HP: " ..members[1].HP) 		
				return true 
			end
		elseif (UnitCastingInfo("player") == GetSpellInfo(8004)) --HealingSurge
		and IsSpellInRange(GetSpellInfo(8004),members[1].Unit) == 1
		and not UnitIsUnit("boss1",members[1].Unit)
		and not UnitBuffID("player",137331)
		and CalStop(members[1].Unit) > Vasa_HealingSurge and CalStop(members[1].Unit) > Vasa_LightningBolt 
		and UnitAffectingCombat("player") then 
			if npcid ~= 62442 and npcid ~= nil then --Tsulong
				VAS_SpellStopCasting() 
				VAS_WriteToChat("\124cFFFF55FFStop Casting HealingSurge - HP: " ..members[1].HP) 		
				return true 	
			end
		elseif (UnitCastingInfo("player") == GetSpellInfo(1064)) --ChainHeal
		and (CalStop(members[1].Unit) > 95 or (lowhpmembers < 3 and CalStop(members[1].Unit) > 90)) 
		and not UnitDebuffID("player",116260)
		and UnitAffectingCombat("player") then 
			VAS_SpellStopCasting() 
			--VAS_WriteToChat("\124cFFFF55FFStop Casting ChainHeal - HP: " ..members[1].HP) 		
			return true	
		elseif water == "Healing Stream Totem" 
		and fire == ""
		and earth == "" 
		and air == "" then
			if waterest_dur <= 2 then
				--VAS_WriteToChat("\124cFFFF55FFLastQueueic Recall HST - waterest_dur: "..waterest_dur) 	
				VAS_Cast(36936,nil)			
			end
		end
	end

	--AutoTarget
	if Vasa_AutoTargetCheck then
		if (not UnitExists("focus")
			or UnitIsDeadOrGhost("focus")
			or not UnitInRange("focus") 
			or not UnitIsConnected("focus")
			or not UnitCanCooperate("player","focus"))
		and (UnitIsDeadOrGhost("target") 
			or not UnitExists("target"))	
		and #Vasa_Tanks > 0 then
			for i=1, #Vasa_Tanks do
				if UnitThreatSituation(Vasa_Tanks[i].Unit) == 3			
				and UnitAffectingCombat("player")		 
				then	
					VAS_AutoFocus(Vasa_Tanks[i].Unit)
					--VAS_TargetUnit(Vasa_Tanks[i].Unit)      		
					--VAS_RunMacroText("/focus")			
					--VAS_RunMacroText("/targetlasttarget")			
				end
			end
		end
		
		if UnitExists("focus")
		and (UnitIsDeadOrGhost("target") or not UnitExists("target"))
		and not UnitIsDeadOrGhost("focustarget")
		and not UnitIsDeadOrGhost("focus")
		and UnitExists("focustarget")
		and UnitCanAttack("player", "focustarget")
		and IsSpellInRange(GetSpellInfo(403),"focustarget") == 1
		and UnitAffectingCombat("player") then
			VAS_TargetUnit("focustarget")
			return false 	
		end
	end

	if VAS_SpellAvailable(52127)
	and not UnitCastingInfo("player")
	and not UnitBuffID("player",52127)
	then
		VAS_Cast(52127,nil)
		return true
	end

	local WEnchant,WEnchantExpires = GetWeaponEnchantInfo()

	if ( not WEnchant or ( Wenchant and WEnchantExpires/60000 < 10 ) ) 
	--and GetSpellCooldown(51730) == 0
	and VAS_SpellAvailable(51730)
	and not UnitCastingInfo("player")
	and IsUsableSpell(51730)
	then 
		VAS_Cast(51730,nil)
		return true 
	end

	if Vasa_HealingTideTotemCheck then	
		if (VachiusaRestoShaman_HealingTideTotem_key and not GetCurrentKeyBoardFocus()) then
			local HStimer, HSTotem = GetTotemInfo(3)
			if VAS_SpellAvailable(108280)		
			and UnitAffectingCombat("player")
			and HSTotem ~= GetSpellInfo(16190) --Healing Mana Totem
			and IsUsableSpell(108280)
			and select(2,GetTalentRowSelectionInfo(5)) == 13
			then 
				if UnitCastingInfo("player") then
					VAS_SpellStopCasting()
				end	
				--VAS_WriteToChat("\124cFFFF55FFRight Shift Key Down - Tide totem!")
				VAS_Cast(108280,nil)
				return true
			end
		end
	end

	if Vasa_AscendanceCheck then	
		if (VachiusaRestoShaman_Ascendance_key and not GetCurrentKeyBoardFocus()) 
		and UnitAffectingCombat("player") 
		--and select(2,GetSpellCooldown(114049)) < 2
		and VAS_SpellAvailable(114049)
		and not UnitCastingInfo("player")
		and IsUsableSpell(114049)
		and not UnitBuffID("player", 114052) then
			--VAS_WriteToChat("\124cFFFF55FFRight Control Key Down - Ascendance!")
			VAS_Cast(114049,nil)
			return true
		end
	end

	if Vasa_HealingRainCheck then	
		if ((VachiusaRestoShaman_HealingRain_key and not GetCurrentKeyBoardFocus()) 
		or (Vasa_HealingRainMouseoverCheck and HRMMode and UnitAffectingCombat("player")))
		and not stopcasting
		and not Vasa_Moving
		and VAS_SpellAvailable(73920)
		--and select(2,GetSpellCooldown(73920)) < 2 	
		and not UnitCastingInfo("player")
		and IsUsableSpell(73920) 
		then
			local WEnchant,WEnchantExpires = GetWeaponEnchantInfo()
		
			if VAS_SpellAvailable(73680)  
			and IsUsableSpell(73680) 				
			and Vasa_UnleashElementsCheck
			and WEnchant 
			then
				local UEtank = false
				if #Vasa_Tanks > 0 
				and Vasa_UETankCheck then
					for i=1, #Vasa_Tanks do
						if UnitThreatSituation(Vasa_Tanks[i].Unit) 
						 --and select(2,GetSpellCooldown(73680)) < 2 
						 and not UnitBuffID(Vasa_Tanks[i].Unit, 118473)
						 and not UnitBuffID(Vasa_Tanks[i].Unit, 73685)
						 and IsSpellInRange(GetSpellInfo(73680),Vasa_Tanks[i].Unit) == 1 then										
							UEtank = true
							VAS_Cast(73680,Vasa_Tanks[i].Unit)	 
							VAS_WriteToChat("\124cFFFF55FFCast Unleash Elements on tank: "..UnitName(Vasa_Tanks[i].Unit))
						end
					end
				end
				if not UEtank
				and not UnitBuffID(members[1].Unit, 118473)
				and not UnitBuffID(members[1].Unit, 73685)
				and members[1].HP <= Vasa_UnleashElements
				--and select(2,GetSpellCooldown(73680)) < 2 
				and IsSpellInRange(GetSpellInfo(73680),members[1].Unit) == 1 then
					VAS_Cast(73680,members[1].Unit)	 
					--VAS_WriteToChat("\124cFFFF55FFCast Unleash Elements - HP: "..members[1].HP)				
				end
			end
				
			VAS_aoeCast(73920,nil)
			--if SpellIsTargeting() then CameraOrSelectOrMoveStart() CameraOrSelectOrMoveStop() end  
			--VAS_WriteToChat("\124cFFFF55FFLeft Alt Key Down - Healing Rain!")
			return true
		end
	end

	--ResAndMRes
	if not UnitAffectingCombat("player") 
	and UnitIsConnected("mouseover")
	and UnitCanCooperate("player","mouseover") 			
	and UnitIsDeadOrGhost("mouseover") 
	and not UnitHasIncomingResurrection("mouseover") 
	then		
		if VAS_SpellAvailable(83968) 		
		and not UnitDebuff("mouseover", GetSpellInfo(95223)) ----Mass Resurrection debuff
		and Vasa_CheckLastCast(83968, 2.0)		
		then
			if IsInRaid() then
					group = "raid"
			elseif IsInGroup() then
					group = "party"
			end
			local deadnum = 0
			if group then
				for i = 1, GetNumGroupMembers() do 
					local member = group..i
					if UnitIsDeadOrGhost(member) then
						if not UnitDebuff(member, GetSpellInfo(95223)) then ----Mass Resurrection debuff 
							deadnum = deadnum + 1
						end
					end
				end
			end		
			if deadnum >= 2 
			and not UnitCastingInfo("player") then
				VAS_Cast(83968,nil) --Mass Resurrection	 
				--VAS_WriteToChat("\124cFFFF55FFMouseover - Auto MasRes!")
				return true		
			end
		end
		
		if VAS_SpellAvailable(2008)
		and IsUsableSpell(2008) 	
		and not UnitCastingInfo("player")	
		and Vasa_CheckLastCast(2008, 2.0)	
		and (IsSpellInRange(GetSpellInfo(2008),"mouseover") == 1) 		
		and not VAS_IsOutOfSight("mouseover") then 
			VAS_Cast(2008,"mouseover") --Resurrection	 
			--VAS_WriteToChat("\124cFFFF55FFMouseover - Auto Res!")
			return true			
		end	
	end

	if select(3, Vasa_UnitInfo("player")) <= 80
	and GetInventoryItemCooldown("player",14) == 0
	and UnitAffectingCombat("player")
	and not UnitCastingInfo("player")
	then VAS_UseInventoryItem(14)
	end

	--PrimalElementalist
	if Vasa_PrimalElementalistCheck 
	and select(2,GetTalentRowSelectionInfo(6)) == 17 
	and UnitAffectingCombat("player") then
		if AverageHealth(Vasa_PrimalElementalistLimit) <= Vasa_PrimalElementalist then
			--FireTotem
			local _,fire = GetTotemInfo(1)
			--EarthTotem
			local _,earth = GetTotemInfo(2)
					
			if not Vasa_PrimalElementalistBuffsOnlyCheck then
				--Fire totem
				if fire == ""
				and IsUsableSpell(2894) 
				and not UnitCastingInfo("player")
				and VAS_SpellAvailable(2894)
				then   
					VAS_Cast(2894,nil)	
					VAS_WriteToChat("\124cFFFF55FFPrimalElementalist - Fire Elemental Totem") 				
					return true 
				elseif earth == ""
				and IsUsableSpell(2062) --Earth Elemental Totem
				and not UnitCastingInfo("player")
				and VAS_SpellAvailable(2062) then   
					VAS_Cast(2062,nil)	
					VAS_WriteToChat("\124cFFFF55FFPrimalElementalist - Earth Elemental Totem") 				
					return true 
				end	
			end
			
			--Empower
			if fire == tostring(GetSpellInfo(2894))
			and VAS_SpellAvailable(118350)
			and not UnitBuffID("PLAYER", 118350)
			--and select(2,GetSpellCooldown(118350)) < 2
			then   
				VAS_Cast(118350,nil)	
				VAS_WriteToChat("\124cFFFF55FFFire Elemental Totem - Cast Empower") 		
				return true 
			end
				
			--Reinforce
			if UnitAffectingCombat("player") 
			and earth == tostring(GetSpellInfo(2062))
			and VAS_SpellAvailable(118347)
			and not UnitBuffID("PLAYER", 118347)
			--and select(2,GetSpellCooldown(118347)) < 2
			then   
				VAS_Cast(118347,nil)	
				VAS_WriteToChat("\124cFFFF55FFEarth Elemental Totem - Cast Reinforce") 			
				return true 
			end	
		end
	end

	local CEarthShield = false

	for i=1, #members do	
		if (UnitBuffID(members[i].Unit, 52127, "PLAYER") --water shield
		and not UnitIsUnit(members[i].Unit, "player"))
		or (UnitBuffID(members[i].Unit, 974, "PLAYER")
		and (select(7, UnitBuffID(members[i].Unit, 974, "PLAYER")) - GetTime() > 1 
		or select(4, UnitBuffID(members[i].Unit, 974, "PLAYER")) > 1)
		and UnitThreatSituation(members[i].Unit) == 3)
		or UnitBuffID("boss1", 974)
		then
			CEarthShield = true
			break
			--VAS_WriteToChat("\124cFFFF55FFShield on: "..UnitName(members[i].Unit)) --error
		end
	end

	if not CEarthShield 
	and VAS_SpellAvailable(974) 
	and IsUsableSpell(974) 
	then
		if #Vasa_Tanks > 0 then
			for i=1, #Vasa_Tanks do
				if UnitThreatSituation(Vasa_Tanks[i].Unit) == 3			 
				 and not UnitCastingInfo("player")
				 and IsSpellInRange(GetSpellInfo(974),Vasa_Tanks[i].Unit) == 1 then
					if Vasa_FixTankESCheck then
						if UnitName(Vasa_Tanks[i].Unit) == Vasa_FixTankES then			 		
							--VAS_CustomTarget = Vasa_Tanks[i].Unit
							VAS_Cast(974,Vasa_Tanks[i].Unit)
							--VAS_WriteToChat("\124cFFFF55FFShield tank!")	
							return true								
						end
					else
						if not UnitBuffID(Vasa_Tanks[i].Unit, 974) then
							--VAS_CustomTarget = Vasa_Tanks[i].Unit
							VAS_Cast(974,Vasa_Tanks[i].Unit)
							--VAS_WriteToChat("\124cFFFF55FFShield tank!")	
							return true												
						end
					end
					--VAS_WriteToChat("\124cFFFF55FFnot Shield: "..UnitName(Vasa_Tanks[i].Unit))	
				end
			end
		end
		
		if UnitThreatSituation(members[1].Unit) == 3	 
		 and members[1].HP < 30 
		 and not UnitIsUnit(members[1].Unit, "player")
		 and not UnitCastingInfo("player")
		 and IsSpellInRange(GetSpellInfo(974),members[1].Unit) == 1 then
			--VAS_CustomTarget = members[1].Unit
			VAS_Cast(974,members[1].Unit)
			--VAS_WriteToChat("\124cFFFF55FFShield high threat member!")	
			return true
		end
	end

	if Vasa_RiptideTankCheck then
		if VAS_SpellAvailable(61295) 
		and IsUsableSpell(61295) 	
		then
			if #Vasa_Tanks > 0 then
				for i=1, #Vasa_Tanks do
					if UnitThreatSituation(Vasa_Tanks[i].Unit) 
					 and not UnitBuffID(Vasa_Tanks[i].Unit, 61295, "PLAYER")
					 and IsSpellInRange(GetSpellInfo(61295),Vasa_Tanks[i].Unit) == 1 then
						if Vasa_Tanks[i].HP < Vasa_RiptideTank 
						and not UnitCastingInfo("player") then
							--VAS_CustomTarget = Vasa_Tanks[i].Unit
							VAS_Cast(61295,Vasa_Tanks[i].Unit)
							--VAS_WriteToChat("\124cFFFF55FFRiptide tank - HP: "..Vasa_Tanks[i].HP)	
							return true
						end
					end
				end
			end
		end
	end

	local arg1, totemName, startTime, duration = GetTotemInfo( 3 )
	local HealingTideTotem = "Healing Tide Totem"
	local ManaTideTotem = "Mana Tide Totem"
	if (totemName == HealingTideTotem or totemName == ManaTideTotem) 
	and (select(2,GetTalentRowSelectionInfo(3)) ~= 8) then --Totemic Persistence talent
		return false
	end

	if UnitAffectingCombat("player") 
	and VAS_SpellAvailable(5394)
	and not UnitCastingInfo("player")
	and IsUsableSpell(5394) 
	--and select(2,GetSpellCooldown(5394)) < 2
	and not Vasa_Moving
	then
		VAS_Cast(5394,nil)
		return true
	end

	if UnitAffectingCombat("player") 
	and members[1].HP < 60
	and lowhpmembers < 3
	and VAS_SpellAvailable(108285) 
	and not UnitCastingInfo("player")
	--and select(2,GetSpellCooldown(108285)) < 2
	and select(2,GetTalentRowSelectionInfo(3)) == 7 then
		VAS_Cast(108285,nil)	 
		VAS_WriteToChat("\124cFFFF55FFCast Call of the Elements for reset HST - HP: " ..members[1].HP) 
		return true
	end

	if Vasa_ForceLightningBoltCheck then	
		if ((VachiusaRestoShaman_ChainHeal_key and not GetCurrentKeyBoardFocus()) 
		or select(3, Vasa_UnitInfo("player")) <= Vasa_ForceLightningBolt)
		and UnitAffectingCombat("player")
		and VAS_SpellAvailable(403) 
		and UnitExists("target")
		and IsUsableSpell(403)
		and not UnitCastingInfo("player")
		and GlyphCheck(55453)
		and IsSpellInRange(GetSpellInfo(403),"target") == 1
		and not LineOfSight("target")
		and UnitCanAttack("player", "target") 
		and not stopcasting then
			VAS_Cast(403,"target")
			return true 
		end
	end

	if Vasa_SpiritWalkerGraceCheck then
		if members[1].HP < Vasa_SpiritWalkerGrace 
		and UnitAffectingCombat("player") 
		and IsUsableSpell(79206)
		and VAS_Moving 
		and not UnitCastingInfo("player")
		and VAS_SpellAvailable(79206)
		then 
			VAS_Cast(79206,nil)
			VAS_WriteToChat("\124cFFFF55FFSpirit walker grace - HP: "..members[1].HP)
			return true 
		end
	end

	--HealingSurgeTank
	if Vasa_HealingSurgeTankCheck then
		if VAS_SpellAvailable(8004) 
		 and UnitAffectingCombat("player")	 
		 and IsUsableSpell(8004)
		 and not Vasa_Moving 
		 and not UnitChannelInfo("player")
		 and not UnitCastingInfo("player")	 
		 and not stopcasting then	 
			if #Vasa_Tanks > 0 then
				for i=1, #Vasa_Tanks do
					if UnitThreatSituation(Vasa_Tanks[i].Unit) 	
					 and Vasa_Tanks[i].HP <= Vasa_HealingSurgeTank
					 and select(3, Vasa_UnitInfo("player")) >= 10 		 
					 and IsSpellInRange(GetSpellInfo(8004),Vasa_Tanks[i].Unit) == 1 then					 
						--VAS_CustomTarget = Vasa_Tanks[i].Unit
						VAS_Cast(8004,Vasa_Tanks[i].Unit)
						--VAS_WriteToChat("\124cFFFF55FFHealing Surge Tank!")	
						return true					
					end
				end
			end
		end
	end

	--TsulongHeal 
	if Vasa_53EventsCheck then	
		local bossCheck = "boss1" 
		local tsulongboss = false
		if UnitExists(bossCheck) then 
			local npcID = tonumber(UnitGUID(bossCheck):sub(6,10), 16) 		      
			if npcID == 62442 
			and UnitAffectingCombat("player") then --Tsulong	
				VAS_WriteToChat("\124cFFFF55FFDebug NPCID: " ..npcID) 
				tsulongboss = true
			end
		end	
		
		if tsulongboss
		and VAS_SpellAvailable(77472)  	
		and IsUsableSpell(77472) 
		and not UnitCastingInfo("player")
		and IsSpellInRange(GetSpellInfo(77472),"boss1") == 1
		and not Vasa_Moving then
			if Vasa_UnitInfo("boss1") < 100 then	
				--if VAS_SpellAvailable(73680)  
				--and IsUsableSpell(73680) 		
				--and select(2,GetSpellCooldown(73680)) < 2 then
					--if not UnitBuffID("boss1", 118473) --Unleashed Fury 
					--and not UnitBuffID("boss1", 73685) then										
						--VAS_Cast(73680,"boss1")	 
						VAS_WriteToChat("\124cFFFF55FFCast Unleash Elements on Tsulong - HP: " ..Vasa_UnitInfo("boss1"))											
					--end			
				--end
						
				if VAS_SpellAvailable(974) 			
				and not UnitCastingInfo("player")
				and IsUsableSpell(974) then
					if UnitBuffID("boss1", 974, "player") then
						if select(7, UnitBuffID("boss1", 974, "player")) - GetTime() <= 1 
						 or select(4, UnitBuffID("boss1", 974, "player")) <= 1 
						 and not UnitCastingInfo("player") then
							VAS_Cast(974,"boss1")	 
							VAS_WriteToChat("\124cFFFF55FFRenew Earth Shield Tsulong - HP: " ..Vasa_UnitInfo("boss1"))
						end
					else
						VAS_Cast(974,"boss1")	 
						VAS_WriteToChat("\124cFFFF55FFCast Earth Shield Tsulong - HP: " ..Vasa_UnitInfo("boss1"))
					end
				end
				
				if VAS_SpellAvailable(61295) 
				and not UnitCastingInfo("player")
				and IsUsableSpell(61295) 
				and not UnitBuffID("boss1",61295,"PLAYER") then			
					VAS_Cast(61295,"boss1")	 
					VAS_WriteToChat("\124cFFFF55FFCast Riptide Tsulong - HP: " ..Vasa_UnitInfo("boss1")) 							
				end	
					
				if VAS_SpellAvailable(16188) 
				and not UnitCastingInfo("player")
				--and select(2,GetSpellCooldown(16188)) < 2
				and (UnitDebuff("player","Bathed in Light") or UnitDebuff("player","Омовение светом") or UnitDebuff("player","In Licht gebadet"))
				and select(2,GetTalentRowSelectionInfo(4)) == 11 then 
					VAS_Cast(16188,"player")	 			
					VAS_WriteToChat("\124cFFFF55FFCast Ancestral Swiftness then GHW Tsulong - HP: " ..Vasa_UnitInfo("boss1")) 			
					VAS_Cast(77472,"boss1")	 
					VAS_WriteToChat("\124cFFFF55FFCast GHW Tsulong - HP: " ..Vasa_UnitInfo("boss1")) 				
					return true							
				end
							
				if VAS_SpellAvailable(8004) 	
				and not UnitCastingInfo("player")	
				and (select(3, Vasa_UnitInfo("player")) > 70 or UnitDebuff("player","Bathed in Light") or UnitDebuff("player","Омовение светом") or UnitDebuff("player","In Licht gebadet")) --Bathed in Light buff		
				and IsUsableSpell(8004) then
					VAS_Cast(8004,"boss1")	 
					VAS_WriteToChat("\124cFFFF55FFCast HSurge on Tsulong - HP: " ..Vasa_UnitInfo("boss1")) 	
					return true
				end		
		
				if members[1].HP > 30 --Prevent raid wipe
				and not UnitCastingInfo("player")
				and lowhpmembers < 10 then 
					VAS_Cast(77472,"boss1")	 
					VAS_WriteToChat("\124cFFFF55FFCast GHW Tsulong - HP: " ..Vasa_UnitInfo("boss1")) 				
					return true	
				end
			end
		end
	end

	if Vasa_ChainHealCheck then
		if VAS_SpellAvailable(1064) 
		 and select(3, Vasa_UnitInfo("player")) > Vasa_LowMana 
		 and IsUsableSpell(1064)		 
		 and not Vasa_Moving
		 and AverageHealth(Vasa_ChainHealLimit) <= Vasa_ChainHeal
		 and not stopcasting 
		 and not LLdebuff 
		 then
			PRGetDistanceTable((Vasa_ChainHeal+5), 13, 3) --12.5	
			PRGetDistanceTablebyHP(Vasa_ChainHeal,3)
				
			if IsSpellInRange(GetSpellInfo(1064),prdistancebyhp[1].Unit) 
			and prdistancebyhp[1].PD >= 3
			and prdistancebyhp[1].HP <= Vasa_ChainHeal 
			and not UnitCastingInfo("player") then		
				--VAS_CustomTarget = prdistancebyhp[1].Unit
				VAS_Cast(1064,prdistancebyhp[1].Unit)
				--VAS_WriteToChat("\124cFFFF55FFCast CH - Name: " ..UnitName(prdistancebyhp[1].Unit).." - HP: "..prdistancebyhp[1].HP.." - PD: "..prdistancebyhp[1].PD) 			
				return true							
			end
		end
	end

	if Vasa_RiptideCheck then	
		if VAS_SpellAvailable(61295) 	
		and IsUsableSpell(61295) then
			for i=1, #members do
				if members[i].HP > Vasa_Riptide then
					break
				end
				if not UnitBuffID(members[i].Unit, 61295, "PLAYER")
				 and IsSpellInRange(GetSpellInfo(61295),members[i].Unit) == 1
				 and not UnitCastingInfo("player")
				 then			 
					if GlyphCheck(63273) then			 	
						if Vasa_CheckLastCast(61295, 2.5) then
							--VAS_CustomTarget = members[i].Unit
							VAS_Cast(61295,members[i].Unit)
							VAS_WriteToChat("\124cFFFF55FFRiptide1 - HP: "..members[i].HP)	
							return true
						 end
					else
						--VAS_CustomTarget = members[i].Unit
						VAS_Cast(61295,members[i].Unit)
						--VAS_WriteToChat("\124cFFFF55FFRiptide2 - HP: "..members[i].HP)	
						return true
					end
				end
			end
		end
	end

	if Vasa_HealingSurgeCheck then
		if VAS_SpellAvailable(8004) 
		 and IsSpellInRange(GetSpellInfo(8004),members[1].Unit) == 1
		 and IsUsableSpell(8004)	 
		 and not Vasa_Moving 
		 and not stopcasting then
			if ((members[1].HP < Vasa_HealingSurge and select(3, Vasa_UnitInfo("player")) > Vasa_LowMana and not UnitBuffID("player",137331)) 
			or (members[1].HP <= 99 and UnitBuffID("player",137331) and ((select(7, UnitBuffID("player", 137331)) - GetTime()) >= 2))) --Meta gem Lucidity
			and not UnitCastingInfo("player") then
				--VAS_CustomTarget = members[1].Unit
				VAS_Cast(8004,members[1].Unit)
				--VAS_WriteToChat("\124cFFFF55FFCast HealingSurge - HP: " ..members[1].HP) 
				return true
			end
		end
	end

	if Vasa_GreaterHealingWaveCheck then	
		--need Unleash Elements buff?
		if VAS_SpellAvailable(77472) 
		 and IsUsableSpell(77472) 	 
		 and IsSpellInRange(GetSpellInfo(77472),members[1].Unit) == 1
		 and not Vasa_Moving 
		 and not stopcasting then
			if members[1].HP < Vasa_GreaterHealingWave then
				if VAS_SpellAvailable(16188) 
				and not UnitCastingInfo("player")
				and select(2,GetTalentRowSelectionInfo(4)) == 11 then 
					VAS_Cast(16188,nil)	 			
					--VAS_WriteToChat("\124cFFFF55FFCast Ancestral Swiftness then GHW - HP: " ..members[1].HP) 
				end
				
				if UnitBuffID("player",53390) 
				and not UnitCastingInfo("player") then --Tidal Waves buff
					--VAS_CustomTarget = members[1].Unit
					VAS_Cast(77472,members[1].Unit)
					--VAS_WriteToChat("\124cFFFF55FFCast GHW - HP: " ..members[1].HP) 				
					return true
				elseif VAS_SpellAvailable(61295) 
				and IsUsableSpell(61295) 
				and not UnitCastingInfo("player")
				and not UnitDebuffID(members[1].Unit,61295,"PLAYER") then
					VAS_CustomTarget = members[1].Unit
					VAS_Cast(61295,members[1].Unit)	 
					VAS_Cast(77472,members[1].Unit)
					--VAS_WriteToChat("\124cFFFF55FFCast Riptide then GHW - HP: " ..members[1].HP) 				
					return true	 	
				end
			end
		end
	end

	if Vasa_HealingWaveCheck then
		if VAS_SpellAvailable(331)
		 and IsUsableSpell(331) 	 
		 and IsSpellInRange(GetSpellInfo(331),members[1].Unit) == 1
		 and not Vasa_Moving 
		 and not stopcasting then
			if members[1].HP < Vasa_HealingWave 
			and lowhpmembers < 3	
			and UnitBuffID("player",53390) 
			and not UnitCastingInfo("player") then --Tidal Waves buff
				 --VAS_CustomTarget = members[1].Unit
				 VAS_Cast(331,members[1].Unit)
				 --VAS_WriteToChat("\124cFFFF55FFCasting HealingWave - HP: " ..members[1].HP) 		
				 return true
			end	
		end
	end

	if Vasa_ManaTideCheck then	
		local HStimer, HSTotem = GetTotemInfo(3)
		if VAS_SpellAvailable(16190)
		and select(3, Vasa_UnitInfo("player")) <= Vasa_ManaTide
		and HSTotem ~= GetSpellInfo(108280) --Healing Tide Totem
		and HSTotem ~= GetSpellInfo(5394) --Healing Stream Totem
		and not UnitCastingInfo("player")
		and UnitAffectingCombat("player")
		and not Vasa_Moving then
			VAS_Cast(16190,nil)
			--VAS_WriteToChat("\124cFFFF55FFManatide - Mana: "..select(3, Vasa_UnitInfo("player")))	
			return true
		end
	end

	if Vasa_LightningBoltCheck then
		if UnitAffectingCombat("player")
		and not stopdps
		and VAS_SpellAvailable(403) 
		and UnitExists("target")
		and IsUsableSpell(403)
		and not UnitCastingInfo("player")
		and IsSpellInRange(GetSpellInfo(403),"target") == 1
		and members[1].HP > Vasa_LightningBolt --95
		and select(3, Vasa_UnitInfo("player")) > Vasa_ForceLightningBolt
		and lowhpmembers < 3
		and not LineOfSight("target")
		and UnitCanAttack("player", "target") 
		and not stopcasting then
			VAS_Cast(403,"target")
			return true 
		end
	end

	local _,fire = GetTotemInfo(1)
	local _,earth = GetTotemInfo(2)
	local _,water = GetTotemInfo(3)
	local _,air = GetTotemInfo(4)
	local arg1, totemName, startTime, duration = GetTotemInfo( 3 )
	local est_dur = startTime+duration-GetTime()

	if not UnitCastingInfo("player")
	and UnitAffectingCombat("player") 
	and VAS_SpellAvailable(36936)
	and fire ~= "Fire Elemental Totem" 
	and earth ~= "Earth Elemental Totem" 
	and water == "Healing Stream Totem" 
	and GlyphCheck(55438) --Glyph of Totemic Recall 
	then   
		if est_dur <= 2 then
			VAS_Cast(36936,nil)
			--VAS_WriteToChat("\124cFFFF55FFLastQueueic Recall HST") 		
			return true 
		end
	end

	if not UnitAffectingCombat("player") 
	and VAS_Moving
	and not UnitCastingInfo("player")
	and VAS_SpellAvailable(36936)
	and fire ~= "Fire Elemental Totem" 
	and earth ~= "Earth Elemental Totem" 
	and water ~= "Mana Tide Totem" 
	and ( fire ~= "" or earth ~= "" or water ~= "" or air ~= "" ) 
	then   
		VAS_Cast(36936,nil)
		VAS_WriteToChat("\124cFFFF55FFLastQueueic Recall") 		
		return true 
	end

	--AirTotem
	local _,air = GetTotemInfo(4)

	--Air totem - maybe need to add tank range check for make sure if will effect on tank
	if UnitAffectingCombat("player") 
	and Vasa_SpiritLinkTotemCheck
	and air == ""
	and members[1].HP < 30
	and not UnitCastingInfo("player")
	and lowhpmembers > 4
	and IsUsableSpell(98008) 
	and VAS_SpellAvailable(98008) then   
		VAS_Cast(98008,nil)	
		VAS_WriteToChat("\124cFFFF55FFSpirit Link Totem - HP"..members[1].HP) 
		return true 
	end

	if UnitAffectingCombat("player") 
	and select(3, Vasa_UnitInfo("player")) > 90
	and air == ""
	and not UnitCastingInfo("player")
	and IsUsableSpell(8177) 
	and VAS_SpellAvailable(8177) then   
		VAS_Cast(8177,nil)	
		--VAS_WriteToChat("\124cFFFF55FFGrounding Totem") 
		return true 
	end

	if UnitAffectingCombat("player") 
	and air == ""
	and (UnitBuffID("player", 32182) --Heroism
	or UnitBuffID("player", 2825) --Bloodlust
	or UnitBuffID("player", 80353) --Time Warp
	or UnitBuffID("player", 90355)) --Ancient Hysteria
	and IsUsableSpell(120668) 
	and not UnitCastingInfo("player")
	and VAS_SpellAvailable(120668) then   
		VAS_Cast(120668,nil)	
		--VAS_WriteToChat("\124cFFFF55FFStormlash Totem") 
		return true 
	end

	--FireTotem
	local _,fire = GetTotemInfo(1)

	--Fire totem
	if UnitAffectingCombat("player") 
	and not stopdps
	and Vasa_DPSTotemCheck
	and select(3, Vasa_UnitInfo("player")) > 90
	and fire == ""
	and UnitExists("target")
	and IsUsableSpell(2894) 
	and not UnitCastingInfo("player")
	and VAS_SpellAvailable(2894)
	and IsSpellInRange(GetSpellInfo(403),"target") == 1
	and UnitCanAttack("player", "target") then   
		VAS_Cast(2894,nil)	
		VAS_WriteToChat("\124cFFFF55FFFire Elemental Totem") 
		return true 
	end

	if UnitAffectingCombat("player") 
	and not stopdps
	and Vasa_DPSTotemCheck
	and select(3, Vasa_UnitInfo("player")) > 90
	and fire == ""
	and UnitExists("target")
	and IsUsableSpell(3599) 
	and not UnitCastingInfo("player")
	and VAS_SpellAvailable(3599)
	and IsSpellInRange(GetSpellInfo(403),"target") == 1
	and UnitCanAttack("player", "target") then   
		VAS_Cast(3599,nil)	
		VAS_WriteToChat("\124cFFFF55FFSearing Totem") 
		return true 
	end

	if PQI_VachiusaGeneral_RotationEngine_value == 4 then
		raidfu = nil
		vicon = nil
		CompactRaidFrameContainer_ApplyToFrames(CompactRaidFrameContainer, "normal", VAS_UpdateIcon)
	elseif PQI_VachiusaGeneral_RotationEngine_value == 7 and not UnitCastingInfo("player") then
		raidfu = nil
		vicon = nil
		HealBot_OnEvent_VachiusaUpdate(vicon,raidfu)
	elseif PQI_VachiusaGeneral_RotationEngine_value == 8 and not UnitCastingInfo("player") then
		raidfu = nil
		vicon = nil
		ElvUF_OnEvent_VachiusaUpdate(vicon,raidfu)	
	end
	return true
end